#ifndef __CAN_MGR_H__
#define __CAN_MGR_H__

#include "ControlCAN.h"
#include <QThread>
#include <QMetaType> 


/*can发送类型*/
enum CAN_SEND_TYPE
{
    CAN_SEND_NORMAL = 0,//正常
    CAN_SEND_SIGNAL,//单次
    CAN_SEND_SELF,//自发自收
    CAN_SEND_SELF_SIGNAL//单次自发自收
};

/*can数据类型*/
enum CAN_DATA_TYPE
{
    CAN_DATA_INFO=0,//数据帧
    CAN_DATA_REMOTE//远程帧
};

/*是否扩展帧*/
enum CAN_EXTERN_TYPE
{
    CAN_FRAM_STANDARD=0,//标准帧
    CAN_FRAM_EXTERN//扩展帧
};

Q_DECLARE_METATYPE(PVCI_CAN_OBJ);


/*这个类主要用来接收和发送can总线数据*/
class CanMgr : public QThread
{
    Q_OBJECT

public:
    CanMgr();

    BOOL open(DWORD baudIdx);
    BOOL close();
    void send(VCI_CAN_OBJ info);

protected:
    void run();
    
private slots:

signals:
    void sendedInfoSignal(PVCI_CAN_OBJ obj);
    void getCanData(PVCI_CAN_OBJ objs,quint32 count);//把接收到的多帧can数据发给解析线程

private:
    
    DWORD m_Type;
    DWORD m_Idx;
    DWORD m_Chl;
    BOOL m_IsOpen;
    VCI_CAN_OBJ recvObj[10];
};



#endif

